package com.tencent.sr.iris.basic.mp.dependency.station;

import com.alibaba.fastjson.JSON;
import com.tencent.sr.iris.basic.mp.common.util.HttpUtils;
import com.tencent.sr.iris.basic.service.interfaces.client.station.StationMessageRecordClient;
import com.tencent.sr.iris.basic.service.interfaces.request.station.StationMessageRecordBasicRequest;
import com.tencent.sr.iris.basic.service.interfaces.request.station.StationMessageRecordPageRequest;
import com.tencent.sr.iris.basic.service.interfaces.response.station.StationMessagePageResponse;
import com.tencent.sr.iris.basic.service.interfaces.response.station.StationMessageRecordPageResponse;
import com.tencent.sr.rmall.common.primitive.HttpResult;
import com.tencent.sr.rmall.common.request.PaginationRequest;
import com.tencent.sr.rmall.common.response.PaginationResponse;
import java.util.List;
import javax.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class StationMessageRecordDependency {
    @Resource
    private StationMessageRecordClient stationMessageRecordClient;

    public Long unreadNum(StationMessageRecordBasicRequest request) {
        log.info("StationMessageRecordDependency.unreadNum，入参：{}", JSON.toJSONString(request));
        HttpResult<Long> result = stationMessageRecordClient.unreadNum(request);
        return HttpUtils.handleError(result);
    }


    public List<StationMessageRecordPageResponse> channelAndStationPage(StationMessageRecordPageRequest request) {
        log.info("StationMessageRecordDependency.channelAndStationPage，入参：{}", JSON.toJSONString(request));
        HttpResult<List<StationMessageRecordPageResponse>> result = stationMessageRecordClient.channelAndStationPage(
                request);
        return HttpUtils.handleError(result);
    }

    public PaginationResponse<StationMessagePageResponse> page(
            PaginationRequest<StationMessageRecordBasicRequest> request) {
        log.info("StationMessageRecordDependency.page，入参：{}", JSON.toJSONString(request));
        HttpResult<PaginationResponse<StationMessagePageResponse>> result = stationMessageRecordClient.page(request);
        return HttpUtils.handleError(result);
    }


    public Boolean readRecord(StationMessageRecordBasicRequest request) {
        log.info("StationMessageRecordDependency.readRecord，入参：{}", JSON.toJSONString(request));
        HttpResult<Boolean> result = stationMessageRecordClient.readRecord(request);
        return HttpUtils.handleError(result);
    }


}
